[pull] main from triggerdotdev:main#136
Merged
Merged
Conversation
…le loaders (#3663) ## Summary - Dashboard loaders for runs / sessions / batches / schedule-detail threw bare `Error("X not found")` when a slug didn't resolve. Remix surfaces this as a 500 and Sentry captures it via auto-instrumentation, producing ongoing noise from real users following stale preview-branch or deleted-resource links (the URLs in those Sentry events all carry `?_data=routes/...`, i.e. client-side revalidation, not full-page navigation). - Added a `throwNotFound(statusText)` helper in `app/utils/httpErrors.ts` that throws a Response with status 404, matching the established pattern in sibling routes (agents, alerts, bulk-actions, etc.). - Migrated 5 loader sites to `throwNotFound` (4× "Environment not found", 1× "Schedule not found"). - Migrated 1 loader site (`runs._index` project branch) to `redirectWithErrorMessage("/", request, "Project not found")` to match the pre-existing convention used by every other dashboard route's project-not-found branch. - Intentionally **not** touched: bare `throw new Error("X not found")` inside `resources.*` action routes (sit inside try/catch blocks that already redirect with a flash message), the invariant assertion in `vercel.connect.tsx`, and the admin config check in `admin.api.v1.runs-replication.backfill.ts`. ## Where the fix is visible Normal browser navigation to these URLs doesn't reach the buggy loaders — the parent env-layout (`_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsx`) already filters missing envs/projects and redirects/404s before the child loader runs. The bug fires exclusively when Remix calls a single child loader via `?_data=routes/...`, which happens during client-side navigation or `useRevalidator`. That matches every Sentry event URL. ## Test plan - [x] Unit test for the new helper — `apps/webapp/test/httpErrors.test.ts` - [x] `pnpm run typecheck --filter webapp` clean - [x] Manual verification via Playwright on `main` vs this branch (6 cases): main returns 500 for each defective `_data` URL; branch returns 404 or 204 + `X-Remix-Redirect` as designed - [x] Verified user-visible 404 catch boundary on `schedules/<missing>` (the one case reachable via normal nav) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )